<?php
namespace Kxdr\Controller;
use Think\Controller;
class EditController extends IndexController {
		public function players(){
			$game_id = I("gid");
			$event_id = I("eid");
			session("event_id",$event_id);
			session("title",null);
			session("start",null);
			session("pic_url",null);
			session("descrip",null);
			session("game_id",$game_id);
			session("game_name",null);
			session("player",null);
			session("player_id",null);
			session("player_descrip",null);
			session("gifting_time",null);
			session("cffs",null);
			session("jzsj",null);
			session("jzfs",null);
			session("cyjf",null);
			session("zmc",null);
			session("event_title",null);
			session("multi_yes",null);
			session("multi_no",null);
			
			$PLAYER = D("EventPlayerView");
			$players = $PLAYER->where("`e_player`.`event_id`=".session("event_id")." AND `e_player`.`sid`=".$this->sid)->getField("epid,event_player_descrip,title,think_type,think_type_way,player_name,player_descrip,is_team");
			foreach($players as $k=>$p){
				foreach(C("KXDR_THINK_WAY") as $way){
					if($p["think_type_way"]==$way["id"]){
						$players[$k]["think_type_way_name"]=$way["name"];break;
					}
				}
			}
			$EVENT = M("KxdrGames");
			$event = current($EVENT->where("`id`=".$game_id." AND (`sid`=".$this->sid." OR `sid`=0)")->getField("`id`,`start_time`,`description`,`game_category`"));

			$EV = M("KxdrEvents");
			$multi = current($EV->where("`id`=".session("event_id")." AND `sid`=".$this->sid)->getField("id,multi_yes,multi_no"));

			session("players",$players);
			$this->assign('game_id',$game_id);
			$this->assign('game_category',$event["game_category"]);
			$this->assign('start',$event["start_time"]);
			$this->assign('descrip',$event["description"]);
			$this->assign('multi_yes',$multi["multi_yes"]);
			$this->assign('multi_no',$multi["multi_no"]);
			$this->assign('players',$players);
			$this->assign('event_id',$event_id);
			$this->assign("edit","players");
			$this->display("Index:step2");
		}
		public function step3(){
			$event_id = I("eid");
			$EVENT = D("EventView");
			$event = current($EVENT->where("`event`.`id`=".$event_id." AND `event`.`sid`=".$this->sid.$q)->getField("id,think_type,think_type_way,time_out,time_out_type,title,description,pic_url,logo_url,need_seeds,gifting_time,game_name,start_time,location,game_descrip,game_pic_url,player_name,player_descrip,event_player_descrip,is_team,game_id,player_id"));
			$PLAYER = D("EventPlayerView");
			$players = $PLAYER->where("`e_player`.`event_id`=".$event_id." AND `e_player`.`sid`=".$this->sid)->getField("epid,think_type,think_type_way,think_type_sign,target_data,player_name,title");
			foreach($players as $k=>$p){
				foreach(C("KXDR_THINK_WAY") as $way){
					if($p["think_type_way"]==$way["id"]){
						$players[$k]["think_type_way_name"]=$way["name"];break;
					}
				}
			}
			session("players",$players);
			session("event_id",$event_id);
			session("gifting_time",$event["gifting_time"]);
			session("event_title",$event["title"]);
			session("title",$event["title"]);
			session("start",$event["start_time"]);
			session("pic_url",$event["pic_url"]);
			session("descrip",$event["descrip"]);
			session("game_id",$event["game_id"]);
			session("game_name",$event["game_name"]);
			session("jzfs",$event["time_out_type"]);
			session("cyjf",$event["need_seeds"]);
			session("jzsj",$event["time_out"]);
			parent::step3();
		}
}